/**fileno*/
#include<errno.h>
#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int main(){
	FILE *f;
	int fd;
	int ret;
	f=fopen("./test.txt","w");
	if(NULL==f){
		perror("fopen failed\n");
		return 1;
	}
	fd=fileno(f);
	if(-1==fd){
		perror("fileno error");
		fclose(f);
		return 1;
	}
	ret=write(fd,"hello world\n",12);
	if(-1==ret){
		perror("write error\n");
		fclose(f);
		return 1;
	}
	close(fd);
	return 0;

}
